Skip to content

feat: JSON diff function with modes #72

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 20, 2025
Merged

feat: JSON diff function with modes #72

merged 2 commits into from
Feb 20, 2025

Conversation

jbee
Copy link
Collaborator

@jbee jbee commented Feb 10, 2025

Summary

Adds a diff function to compute the difference between 2 JSON values.

A JsonDiff.Mode can be used to adjust the comparison:

  • is order relevant for array elements or object members?
  • can additional array elements or object members be present that are ignored
  • are numbers compared numerically or by their text value

To customize individual object properties 2 new annotations can be used to annotate the method

  • @AnyOrder: the array elements or object members returned by the annotated method can be in any order
  • @AnyAdditional: the array or object returned by the annotated method may contain additional elements/members

Automatic Testing

New tests were added.

Documentation

See changes in README.md

@jbee jbee self-assigned this Feb 10, 2025
@jbee jbee merged commit 1682c81 into main Feb 20, 2025
1 check passed
@jbee jbee deleted the json-diff branch February 20, 2025 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant